home *** CD-ROM | disk | FTP | other *** search
- Path: galaxy.ucr.edu!not-for-mail
- From: thp@cs.ucr.edu (Tom Payne)
- Newsgroups: comp.lang.c++
- Subject: Re: popen() equivalent in c++
- Date: 27 Jan 1996 19:39:44 GMT
- Organization: University of California, Riverside Department of Computer Science
- Message-ID: <4edv20$si6@galaxy.ucr.edu>
- References: <Pine.SUN.3.91.960123133630.6989A-100000@lab-208-10>
- NNTP-Posting-Host: corvette.ucr.edu
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Jason Hess (hess@mendoza.mathcs.unbc.edu) wrote:
- : There must be a popen() equivalent in c++ but I can't seem to find it.
- : I'm using g++2.7.0. Help me.
- :
- : Jason Hess.
-
-
- The following works under g++ 2.6.3 under Linux:
-
- int main() {
- ifstream inpipe( fileno( popen("ls", "r") ) );
- if ( ! inpipe ) perror("failed");
- char c;
- while ( inpipe.get(c) ) cout << c;
- return 0;
- }
-
-
- Tom Payne (cs.ucr.edu)
-